import { NgModule, ApplicationRef } from '@angular/core';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { SecurityRequestInterceptor } from './common/interceptor/security-request.interceptor';
import { ErrorResponseInterceptor } from './common/interceptor/error-response.interceptor';
import { AuthorityGuard } from './common/interceptor/authority.guard';
import { CommonService } from './common/service/common.service';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MdlModule } from '@angular-mdl/core';
import { QkSharedModule } from './common/module/qkshare.module';
import { DataScrollerModule, MenubarModule } from 'primeng/primeng';
import { EditorModule } from 'primeng/editor';
import { ButtonModule } from 'primeng/button';
import { GrowlModule } from 'primeng/growl';
import { FileUploadModule } from 'primeng/fileupload';
import { InputTextModule } from 'primeng/inputtext';
import { PasswordModule } from 'primeng/password';
import { RadioButtonModule } from 'primeng/radiobutton';
import { CalendarModule } from 'primeng/calendar';
import { TooltipModule } from 'primeng/tooltip';
import { AppRoutingModule } from './app.routes';
import { ConfirmDialogModule } from 'primeng/confirmdialog';
import { AppComponent } from './app.component';
import { LoginComponent } from './common/component/login/login.component';
import { LoginLawcaseComponent } from './common/component/login/login-lawcase.component';
import { QkProfileComponent } from './common/component/profile/profile.component';
import { DesktopComponent } from './common/component/desktop/desktop.component';
import { Page404Component } from './common/component/404/page404.component';
import { QkNoticeComponent } from './common/component/notice/qknotice.component';
import { AutoCompleteModule } from 'primeng/autocomplete';
import { QkProfileService } from './common/component/profile/profile.service';
import { NgZorroAntdModule, NZ_I18N, zh_CN } from 'ng-zorro-antd';
import { NzUploadModule } from 'ng-zorro-antd/upload';
import { NzIconModule } from 'ng-zorro-antd/icon';
import { IconDefinition } from '@ant-design/icons-angular';
import { NZ_ICON_DEFAULT_TWOTONE_COLOR, NZ_ICONS } from 'ng-zorro-antd';
import { PlusOutline } from '@ant-design/icons-angular/icons';//单独导入plus图片
const icons: IconDefinition[] = [PlusOutline];
import { InputSwitchModule } from 'primeng/inputswitch';
import { NzCascaderModule } from 'ng-zorro-antd/cascader';
import { UnopenComponent } from './common/component/unopen/unopen.component';
import { NzInputModule } from 'ng-zorro-antd/input';
import { DropdownModule } from 'primeng/primeng';
import { TableModule } from 'primeng/table';
import { RatingModule } from 'primeng/primeng';
import { CheckboxModule } from 'primeng/checkbox';

/** 配置 angular i18n **/
import { registerLocaleData } from '@angular/common';
import zh from '@angular/common/locales/zh';
registerLocaleData(zh);

//测试图片墙导入的包结束
@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    FormsModule,
    HttpClientModule,
    ReactiveFormsModule,
    AppRoutingModule,
    MdlModule,
    QkSharedModule,
    DataScrollerModule,
    EditorModule,
    ButtonModule,
    GrowlModule,
    PasswordModule,
    FileUploadModule,
    InputTextModule,
    CalendarModule,
    RadioButtonModule,
    TooltipModule,
    AutoCompleteModule,
    ConfirmDialogModule,
    MenubarModule,
    NgZorroAntdModule,
    NzUploadModule,
    NzIconModule,
    InputSwitchModule,
    NzCascaderModule,
    NzInputModule,
    DropdownModule,
    TableModule,
    RatingModule,
    CheckboxModule,
  ],
  declarations: [
    AppComponent,
    LoginComponent,
    LoginLawcaseComponent,
    QkProfileComponent,
    DesktopComponent,
    Page404Component,
    QkNoticeComponent,
    UnopenComponent
  ],
  entryComponents: [
    QkProfileComponent,
    QkNoticeComponent
  ],
  providers: [
    AuthorityGuard,
    CommonService,
    QkProfileService,
    {
      provide: HTTP_INTERCEPTORS,
      useClass: SecurityRequestInterceptor,
      multi: true,
    },
    {
      provide: HTTP_INTERCEPTORS,
      useClass: ErrorResponseInterceptor,
      multi: true,
    },
    { provide: NZ_I18N, useValue: zh_CN },
    { provide: NZ_ICON_DEFAULT_TWOTONE_COLOR, useValue: '#00ff00' }, // 不提供的话，即为 Ant Design 的主题蓝色
    { provide: NZ_ICONS, useValue: icons }
  ],
  bootstrap: [
    AppComponent
  ]
})
export class AppModule {
  constructor(public appRef: ApplicationRef) {
  }
}
